package cn.csc.module.shop.controller.app.slideimg;

import cn.csc.framework.common.pojo.CommonResult;
import cn.csc.framework.common.pojo.PageResult;
import cn.csc.module.shop.controller.admin.slideimg.vo.ShopSlideImgPageReqVO;
import cn.csc.module.shop.controller.admin.slideimg.vo.ShopSlideImgRespVO;
import cn.csc.module.shop.convert.slideimg.ShopSlideImgConvert;
import cn.csc.module.shop.dal.dataobject.slideimg.ShopSlideImgDO;
import cn.csc.module.shop.service.slideimg.ShopSlideImgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static cn.csc.framework.common.pojo.CommonResult.success;

/**
 * @author liuchuang
 * @version 1.0
 * @modify
 * @since 2024/12/9 14:56
 */
@Api(tags = "app后台 - 轮播图")
@RestController
@RequestMapping("/shop/slide-img")
@Validated
public class AppShopSlideImgController {

    @Resource
    private ShopSlideImgService slideImgService;


    @GetMapping("/page")
    @ApiOperation("获得轮播图分页")
    public CommonResult<PageResult<ShopSlideImgRespVO>> getSlideImgPage(@Valid ShopSlideImgPageReqVO pageVO) {
        PageResult<ShopSlideImgDO> pageResult = slideImgService.getSlideImgPage(pageVO);
        return success(ShopSlideImgConvert.INSTANCE.convertPage(pageResult));
    }


}
